package com.example.app.controller;

import com.example.app.entity.Emp;
import com.example.app.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author wangzhuangzhuang
 * @DESC:
 * @date 2022-02-25 13:52
 */
@RestController
public class EmpController {

	@Resource
	private EmpService empService;

	@RequestMapping("/emp/list")
	@ResponseBody
	public List<Emp> getEmpInfos(){
		return empService.getAllEmpInfo();
	}

	@RequestMapping("/emp/info")
	@ResponseBody
	public String getEmpByName(@RequestParam(value = "name", defaultValue = "admin") String name){
		return empService.getEmpInfoByName(name);
	}
}